<template>
  <div class="mod-config" style="padding-bottom: 10px;">
    <div class="app-title">
      <div style="float:left;padding: 10px;">{{title}} <a style="font-size: 12px;" href="/html/wpbHelper.html">操作说明</a></div>
      <img class="avatar" :src="userInfo.avatar+'_60x60q90.jpg'" /><span style="font-size: 14px"> 你好， {{userInfo.realName}} </span>
    </div>
    <div class="pj_container">
      <keep-alive>
        <router-view></router-view>
      </keep-alive>
    </div>
    <div class="foot">
      <router-link to="/wpb-project">
        <div>
          <i class="el-icon-document"></i><br>
          项目
        </div>
      </router-link>
      <router-link to="/wpb-board">
        <div>
          <i class="el-icon-date"></i><br>
          看板
        </div>
      </router-link>
      <router-link to="/wpb-dyn">
        <div>
          <i class="el-icon-set-up"></i><br>
          时轴
        </div>
      </router-link>
      <router-link to="/wpb-log">
        <div>
          <i class="el-icon-edit"></i><br>
          日志
        </div>
      </router-link>
    </div>
  </div>
</template>

<script>
  import dingMixin from  '@/mixins/ding'
  import * as dd from 'dingtalk-jsapi'
  import '@/assets/iconfont/iconfont.css'

  export default {
    data () {
      return {
        title:'工作进吧 v1.0'
      }
    },
    mixins: [dingMixin],
    created() {
      if (dd.env.platform!="notInDingTalk") {
        if(this.userInfo && this.userInfo.dingId && this.dingConfig.corpId && this.$cookie.get('token')>'') {
          return;
        }
        this.getDingConfig().then(config =>{
          this.dingConfig = config;
          this.dingLogin(config.corpId, null);
        })
      }
    },
    methods: {

    },
    watch:{
      '$route' (to, from){
        if(to.name=='wpb-log'){
          this.title='';  //日志
        }
        else if(to.name=='wpb-board'){
          this.title='工作进吧 v1.0';
        }
        else if(to.name=='wpb-dyn'){
          this.title='项目动态';
        }
        else if(to.name=='wpb-project'){
          this.title='项目列表';
        }
      }
    }
  }
</script>

<style scoped>
  .avatar{
    width: 36px;
    height: auto;
    margin-right: 15px;
    border-radius: 100%;
    vertical-align: middle;
  }
  .app-title {
    z-index: 3;
    background: white;
    position: fixed;
    width:100%;
    top:0px;
    left:0px;
    padding:5px 10px;
    height:48px;
    font-size: 18px;
    text-align: right;
    border-bottom: lightgray solid 1px;
  }
  .pj_container{
    margin-top: 48px;
  }


  .foot{
    width:100%;
    height:48px;
    position: fixed;
    bottom:0px;
    left:0px;
    border-top: #bbb solid 1px;
    cursor:pointer;
    background: white;
    z-index: 9;
  }

  .foot div{
    float:left;
    height:48px;
    width:25%;
    padding:5px;
    text-align: center;
  }

  .el-calendar__body{
    padding:5px;
  }

  .router-link-exact-active{
    color: #26c212;   /* #409EFF;*/
    font-weight: bold;
  }

</style>

